#ifndef MUSICPLAYER_H
#define MUSICPLAYER_H

#include "volumecontrol.h"
#include "controlButton.h"
#include "sumHeader.h"

#define MUSICPLAYBUTTON_WIDTH   80
#define MUSICPLAYBUTTON_HEIGHT  80

#define CDJOYSTICK_POS_X        440
#define CDJOYSTICK_POS_Y        144

class MusicPlayer:public QWidget
{
    Q_OBJECT
public:
    MusicPlayer();
    ~MusicPlayer();
public:
    const constexpr static int MusicPlayButtonWidth = 80;
    const constexpr static int MusicPlayButtonHEIGH = 80;
    const constexpr static int CDJoyStickPosX = 440;
    const constexpr static int CDJoyStickPosY = 144;
private slots:
    void changeStatue(bool);
    void changeVolume(double);
    void changeVlcProgress(double);
    void update();
signals:
    void sendMusicInformationToTop(QString songName, QString artist);
    void sendMusicLenthToProgressBar(double len);
    void resetToBegin();
    void sendMusicProgress(double rotia);
    void pauseMusicToControlButton();
private:
    void loadWidget();
    void dragEnterEvent(QDragEnterEvent *event) override;
    void dropEvent(QDropEvent *event) override;
    bool upDateSong(QString musicPath);
private:
//    QWidget *_progressBar;
//    QWidget *_cd;
//    QWidget *_controlButton;
//    QWidget *_volumeBar;
    libvlc_instance_t *_musicInst;
    QString _musicInformationUp, _musicInformationLower;
    libvlc_media_player_t *_musicMediaPalyer;
    VolumeControl *_volumnContral;
    QTimer *_timer;
    ControlButton *_controlButton;
};

#endif // MUSICPLAYER_H
